﻿
#ifndef MENU_BUILDER_H
#define MENU_BUILDER_H

#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include <QObject>
#pragma execution_character_set("utf-8")
class MenuBar : public QMenuBar
{
	Q_OBJECT
public:
	explicit MenuBar(QWidget* parent = nullptr);
	QAction* getAction(const QString& menuName, const QString& actionText);


signals:
	void undo();
	void redo();
	void copy();
	void paste();
	void cut();
	void fontStyleChange(const QString& stylename);
	void newDocumentTriggered();
	void openDocumentTriggered();
	void saveDocumentTriggered();      
	void saveAsDocumentTriggered();     

private slots:
	void onExitTriggered(); 

private:
	QMenu* createOrGetMenu(const QString& menuName);
	QHash<QString, QMenu*> m_menus;  
	QHash<QString, QAction*> m_actions;  

};

#endif // MENU_BUILDER_H